import java.io.File;
import java.util.Scanner;

public class ClientMain {
    public static void main(String[] args) {
        Scanner key=new Scanner(System.in);
        while(true){
            System.out.println("====请输入url====");
            String url=key.next();
            if(url.indexOf("upload")!=-1){
                System.out.println("====请输入要上传的文件路径====");
                String filepath=key.next();
                File file=new File(filepath);
                System.out.println("本次访问结果：\r\n"+HttpTools.postFile(url,file));
            }else if(url.indexOf("download")!=-1){
                System.out.println("本次访问结果：\r\n"+HttpTools.getFile(url));
                System.out.println("本地文件保存位置为：D:/AppData/，请自行查看下载情况");
            }else if(url.indexOf("check")!=-1){
                System.out.println("本次访问结果:\r\n"+HttpTools.get(url));
            }else {
                System.out.println("服务器端无该url");
            }
        }
    }

}